home *** CD-ROM | disk | FTP | other *** search
Gui4CLI script | 1980-01-03 | 3.2 KB | 141 lines |
- G4C
-
- ; This GUI is similar to the Workbench "Execute command" GUI, but more.
- ; There is a textin gadget for entering commands, buttons for choosing
- ; files, changing the directory, and opening a newshell.
-
- ; More important, it can also send ARexx commands to the port shown
- ; in the other (bottom right) textin gadget (which can also be changed)
-
-
- WinBig 10 30 520 38 "Enter commands :"
- WinSmall 0 -1 422 30
- WinType 11110010
- varpath '' ; whoever wants our vars can include us in his path
-
- xOnLoad
- cl_Main = "" ; our main variable.
- cl_Mode = G4C ; Mode to run the command
- cl_Port = Gui4Cli ; Name of default port (can also sendrexx to ourselves)
-
- ; On opening we display the current directory in the titlebar (note large buffer)
-
- xOnOpen
- setwintitle cli.gc "$$CURRENT_DIR "
- Update cli.gc 1 $cl_Main ; show whatever the command line is
- SetGad cli.gc 1 ON ; to get the cursor in the gadget immediately
-
- ; On quitting we delete the variables
-
- xOnQuit
- delvar cl_#?
-
- xOnRMB
- status
-
-
- ;================================> Main text input gadget
-
- xTEXTIN 10 3 480 16 "" cl_Main "" 512
- gadid 1
- gosub cli.gc DoCommand
-
- xButton 495 4 20 14 C ; clear the command line
- cl_Main = ""
- update cli.gc 1 ""
-
-
- ;========> Cycler for choosing ARexx/CLI/RUN modes
-
- xCYCLER 10 20 80 14 "" cl_Mode
- GadID 10 ; we may want to change it from elsewhere
- CSTR ARexx G4C
- CSTR CLI CLI
- CSTR RUN RUN
- CSTR Exec EXEC
-
-
- ;========> GO button (to execute the command)
-
- xBUTTON 90 20 40 14 "GO!"
- gosub cli.gc DoCommand
-
-
- ;=======> button for file requester for commands
-
- xbutton 135 20 65 14 "Cmd.."
- cl_cmd = ""
- REQFILE -1 -1 300 -60 "Choose Files" LOAD cl_cmd sys:c
- if $cl_cmd > ""
- cl_temp = $cl_Main
- cl_Main = '$cl_cmd '
- appvar cl_Main $cl_temp
- update cli.gc 1 $cl_Main
- delvar cl_temp
- endif
-
- ;========> Button for File requester for filenames
-
- xBUTTON 200 20 65 14 "Files.."
- cl_File = ""
- REQFILE -1 -1 300 -60 "Choose Files" MULTI cl_File $$CURRENT_DIR
- if $cl_File > ""
- appvar cl_Main $cl_File
- update cli.gc 1 $cl_Main
- endif
-
-
- ;========> Button to open a shell
-
- xBUTTON 265 20 40 14 Cli
- CLI 'Newshell "con:0/150/640/100/NewShell/CLOSE"'
-
-
- ;========> Button to change directory
-
- xBUTTON 305 20 40 14 CD
- setvar cl_Dir ""
- REQFILE -1 -1 300 -60 "Choose directory" DIR cl_Dir ""
- if $cl_Dir > ""
- CD $cl_Dir
- SetWinTitle cli.gc "$cl_Dir "
- endif
-
-
- ;========> TEXTin gadget to get port name for sendrexx command
-
- xTEXTIN 390 20 125 16 "Port" cl_Port "Gui4Cli" 40
- GadID 2
-
-
- ;========> ROUTINE to execute command
-
- xROUTINE DoCommand
- docase $cl_Mode
- case = G4C
- SendRexx $cl_Port $cl_Main
- SetWinTitle cli.gc "Return : $$RETCODE $$REXXRET "
- break
- case = CLI
- CLI $cl_Main
- SetWinTitle cli.gc "Return : $$RETCODE"
- break
- case = RUN
- RUN $cl_Main
- SetWinTitle cli.gc "Return : $$RETCODE"
- break
- case = EXEC
- CLI 'execute $cl_Main'
- SetWinTitle cli.gc "Return : $$RETCODE"
- break
- endcase
-
-
- ;=========> before commands are executed, we restore the window title
-
- xBEFORE
- SetWinTitle cli.gc "$$CURRENT_DIR "
-
-
-
-